<?php
	require_once('Model/getconfig.php');	
	$arrUsers=array();

	if(isset($_POST['username'])) $strusername=$_POST['username'];
	if(isset($_POST['pass1'])) $strpassword=$_POST['pass1'];
   
    $arrUsers=Model_membermaster::checkUser($strusername,$strpassword); 
 
	if(count($arrUsers)>0){
		$objMemmaster=$arrUsers[0];
		$_SESSION['userid']=$objMemmaster->getuserid();
		$_SESSION['username']=$objMemmaster->getUsername();
		$firstname=$objMemmaster->getFirstname();
		//$secondname=$objMemmaster->getSecondname();
		$name=$firstname;
		$_SESSION['name']=$name;
		Jscript_phpjs::redirect('index.php');
		
		//echo 'success';
	}
	else{
	
			$hasError = true;				
			$errorMessage = "Invalid username or password( Username or password not matching to our database details)!";
 ?>
	<div class="error_box">
		There was an error submitting the form.
		<br />
		<?php echo $errorMessage;?>
	</div>
<?php 
	
		}

?>